export function fillCapsule (ctx, txt, x, y, height = 32, radius = 16, bg = '#EBECF0', color = '#333') {
  ctx.font = '12px Georgia'
  ctx.textBaseline = 'middle'
  const width = ctx.measureText(txt).width
  ctx.beginPath()
  ctx.arc(x + radius, y + radius, radius, Math.PI, Math.PI * 1.5)
  ctx.lineTo(width + x + radius, y)
  ctx.arc(width + x + radius, radius + y, radius, Math.PI * 1.5, Math.PI * 2)
  ctx.arc(width + x + radius, height - radius + y, radius, 0, Math.PI * 0.5)
  ctx.lineTo(radius + x, height + y)
  ctx.arc(radius + x, height - radius + y, radius, Math.PI * 0.5, Math.PI)
  ctx.closePath()
  ctx.fillStyle = bg
  ctx.fill()
  ctx.fillStyle = color
  ctx.font = '12px sans-serif'
  ctx.fillText(txt, x + radius, y + radius)
}
